<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>&lt;GUri&gt;: </title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.2">
<link rel="home" href="index.html" title="">
<link rel="up" href="ch01.html" title="GLib">
<link rel="prev" href="re76.html" title="&lt;%GLibUnicodeType&gt;">
<link rel="next" href="re78.html" title="&lt;%GLibUriError&gt;">
<meta name="generator" content="GTK-Doc V1.33.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts"></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><img src="up-insensitive.png" width="16" height="16" border="0"></td>
<td><a accesskey="p" href="re76.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="re78.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="id-1.1.78"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2>&lt;GUri&gt;</h2>
<p>&lt;GUri&gt;</p>
</div>
<div class="refsect1">
<a name="id-1.1.78.2"></a><h2>Description</h2>
<p>The <span class="type">GUri</span> type and related functions can be used to parse URIs into
their components, and build valid URIs from individual components.
</p>
<p>Note that <span class="type">GUri</span> scope is to help manipulate URIs in various applications,
following [RFC 3986](https://tools.ietf.org/html/rfc3986). In particular,
it doesn't intend to cover web browser needs, and doesn't implement the
[WHATWG URL](https://url.spec.whatwg.org/) standard. No APIs are provided to
help prevent
[homograph attacks](https://en.wikipedia.org/wiki/IDN_homograph_attack), so
<span class="type">GUri</span> is not suitable for formatting URIs for display to the user for making
security-sensitive decisions.
</p>
<div class="refsect2">
<a name="id-1.1.78.2.4"></a><h3>Relative and absolute URIs <a name="relative-absolute-uris"></a>
</h3>
<p>As defined in [RFC 3986](https://tools.ietf.org/html/rfc3986#section-4), the
hierarchical nature of URIs means that they can either be ‘relative
references’ (sometimes referred to as ‘relative URIs’) or ‘URIs’ (for
clarity, ‘URIs’ are referred to in this documentation as
‘absolute URIs’ — although
[in constrast to RFC 3986](https://tools.ietf.org/html/rfc3986#section-4.3),
fragment identifiers are always allowed).
</p>
<p>Relative references have one or more components of the URI missing. In
particular, they have no scheme. Any other component, such as hostname,
query, etc. may be missing, apart from a path, which has to be specified (but
may be empty). The path may be relative, starting with <code class="code">./</code> rather than <code class="code">/</code>.
</p>
<p>For example, a valid relative reference is <code class="code">./path?query</code>,
<code class="code">/?query#fragment</code> or <code class="code">//example.com</code>.
</p>
<p>Absolute URIs have a scheme specified. Any other components of the URI which
are missing are specified as explicitly unset in the URI, rather than being
resolved relative to a base URI using <code class="function">g_uri_parse_relative()</code>.
</p>
<p>For example, a valid absolute URI is <code class="code">file:///home/bob</code> or
<code class="code">https://search.com?query=string</code>.
</p>
<p>A <span class="type">GUri</span> instance is always an absolute URI. A string may be an absolute URI
or a relative reference; see the documentation for individual functions as to
what forms they accept.
</p>
</div>
<div class="refsect2">
<a name="id-1.1.78.2.5"></a><h3>Parsing URIs</h3>
<p>The most minimalist APIs for parsing URIs are <code class="function">g_uri_split()</code> and
<code class="function">g_uri_split_with_user()</code>. These split a URI into its component
parts, and return the parts; the difference between the two is that
<code class="function">g_uri_split()</code> treats the ‘userinfo’ component of the URI as a
single element, while <code class="function">g_uri_split_with_user()</code> can (depending on the
<span class="type">GUriFlags</span> you pass) treat it as containing a username, password,
and authentication parameters. Alternatively, <code class="function">g_uri_split_network()</code>
can be used when you are only interested in the components that are
needed to initiate a network connection to the service (scheme,
host, and port).
</p>
<p><code class="function">g_uri_parse()</code> is similar to <code class="function">g_uri_split()</code>, but instead of returning
individual strings, it returns a <span class="type">GUri</span> structure (and it requires
that the URI be an absolute URI).
</p>
<p><code class="function">g_uri_resolve_relative()</code> and <code class="function">g_uri_parse_relative()</code> allow you to
resolve a relative URI relative to a base URI.
<code class="function">g_uri_resolve_relative()</code> takes two strings and returns a string,
and <code class="function">g_uri_parse_relative()</code> takes a <span class="type">GUri</span> and a string and returns a
<span class="type">GUri</span>.
</p>
<p>All of the parsing functions take a <span class="type">GUriFlags</span> argument describing
exactly how to parse the URI; see the documentation for that type
for more details on the specific flags that you can pass. If you
need to choose different flags based on the type of URI, you can
use <code class="function">g_uri_peek_scheme()</code> on the URI string to check the scheme
first, and use that to decide what flags to parse it with.
</p>
<p>For example, you might want to use <code class="constant">G_URI_PARAMS_WWW_FORM</code> when parsing the
params for a web URI, so compare the result of <code class="function">g_uri_peek_scheme()</code> against
<code class="code">http</code> and <code class="code">https</code>.
</p>
</div>
<div class="refsect2">
<a name="id-1.1.78.2.6"></a><h3>Building URIs</h3>
<p><code class="function">g_uri_join()</code> and <code class="function">g_uri_join_with_user()</code> can be used to construct
valid URI strings from a set of component strings. They are the
inverse of <code class="function">g_uri_split()</code> and <code class="function">g_uri_split_with_user()</code>.
</p>
<p>Similarly, <code class="function">g_uri_build()</code> and <code class="function">g_uri_build_with_user()</code> can be used to
construct a <span class="type">GUri</span> from a set of component strings.
</p>
<p>As with the parsing functions, the building functions take a
<span class="type">GUriFlags</span> argument. In particular, it is important to keep in mind
whether the URI components you are using are already <code class="code">%</code>-encoded. If so,
you must pass the <code class="constant">G_URI_FLAGS_ENCODED</code> flag.
</p>
</div>
<div class="refsect2">
<a name="id-1.1.78.2.7"></a><h3>`file://` URIs</h3>
<p>Note that Windows and Unix both define special rules for parsing
<code class="code">file://</code> URIs (involving non-UTF-8 character sets on Unix, and the
interpretation of path separators on Windows). <span class="type">GUri</span> does not
implement these rules. Use <code class="function">g_filename_from_uri()</code> and
<code class="function">g_filename_to_uri()</code> if you want to properly convert between
<code class="code">file://</code> URIs and local filenames.
</p>
</div>
<div class="refsect2">
<a name="id-1.1.78.2.8"></a><h3>URI Equality</h3>
<p>Note that there is no <code class="code">g_uri_equal ()</code> function, because comparing
URIs usefully requires scheme-specific knowledge that <span class="type">GUri</span> does
not have. For example, <code class="code">http://example.com/</code> and
<code class="code">http://EXAMPLE.COM:80</code> have exactly the same meaning according
to the HTTP specification, and <code class="code">data:,foo</code> and
<code class="code">data:;base64,Zm9v</code> resolve to the same thing according to the
<code class="code">data:</code> URI specification.</p>
</div>
</div>
<div class="refsect1">
<a name="id-1.1.78.3"></a><h2>Functions</h2>
<div class="refsect2">
<a name="id-1.1.78.3.2"></a><h3>get-auth-params</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-auth-params self))
</pre></div>
<p>Gets <em class="parameter"><code>uri</code></em>'s authentication parameters, which may contain
<code class="code">%</code>-encoding, depending on the flags with which <em class="parameter"><code>uri</code></em> was created.
(If <em class="parameter"><code>uri</code></em> was not created with <code class="constant">G_URI_FLAGS_HAS_AUTH_PARAMS</code> then this will
be <code class="constant">NULL</code>.)
</p>
<p>Depending on the URI scheme, <code class="function">g_uri_parse_params()</code> may be useful for
further parsing this information.</p>
<div class="refsect3">
<a name="id-1.1.78.3.2.5"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.3"></a><h3>get-flags</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-flags self))
</pre></div>
<p>Gets <em class="parameter"><code>uri</code></em>'s flags set upon construction.</p>
<div class="refsect3">
<a name="id-1.1.78.3.3.4"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.4"></a><h3>get-fragment</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-fragment self))
</pre></div>
<p>Gets <em class="parameter"><code>uri</code></em>'s fragment, which may contain <code class="code">%</code>-encoding, depending on
the flags with which <em class="parameter"><code>uri</code></em> was created.</p>
<div class="refsect3">
<a name="id-1.1.78.3.4.4"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.5"></a><h3>get-host</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-host self))
</pre></div>
<p>Gets <em class="parameter"><code>uri</code></em>'s host. This will never have <code class="code">%</code>-encoded characters,
unless it is non-UTF-8 (which can only be the case if <em class="parameter"><code>uri</code></em> was
created with <code class="constant">G_URI_FLAGS_NON_DNS</code>).
</p>
<p>If <em class="parameter"><code>uri</code></em> contained an IPv6 address literal, this value will be just
that address, without the brackets around it that are necessary in
the string form of the URI. Note that in this case there may also
be a scope ID attached to the address. Eg, <code class="code">fe80::1234%</code><code class="code">em1</code> (or
<code class="code">fe80::1234%</code><code class="code">25em1</code> if the string is still encoded).</p>
<div class="refsect3">
<a name="id-1.1.78.3.5.5"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.6"></a><h3>get-password</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-password self))
</pre></div>
<p>Gets <em class="parameter"><code>uri</code></em>'s password, which may contain <code class="code">%</code>-encoding, depending on
the flags with which <em class="parameter"><code>uri</code></em> was created. (If <em class="parameter"><code>uri</code></em> was not created
with <code class="constant">G_URI_FLAGS_HAS_PASSWORD</code> then this will be <code class="constant">NULL</code>.)</p>
<div class="refsect3">
<a name="id-1.1.78.3.6.4"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.7"></a><h3>get-path</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-path self))
</pre></div>
<p>Gets <em class="parameter"><code>uri</code></em>'s path, which may contain <code class="code">%</code>-encoding, depending on the
flags with which <em class="parameter"><code>uri</code></em> was created.</p>
<div class="refsect3">
<a name="id-1.1.78.3.7.4"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.8"></a><h3>get-port</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-port self))
</pre></div>
<p>Gets <em class="parameter"><code>uri</code></em>'s port.</p>
<div class="refsect3">
<a name="id-1.1.78.3.8.4"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.9"></a><h3>get-query</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-query self))
</pre></div>
<p>Gets <em class="parameter"><code>uri</code></em>'s query, which may contain <code class="code">%</code>-encoding, depending on the
flags with which <em class="parameter"><code>uri</code></em> was created.
</p>
<p>For queries consisting of a series of <code class="code">name=value</code> parameters,
<span class="type">GUriParamsIter</span> or <code class="function">g_uri_parse_params()</code> may be useful.</p>
<div class="refsect3">
<a name="id-1.1.78.3.9.5"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.10"></a><h3>get-scheme</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-scheme self))
</pre></div>
<p>Gets <em class="parameter"><code>uri</code></em>'s scheme. Note that this will always be all-lowercase,
regardless of the string or strings that <em class="parameter"><code>uri</code></em> was created from.</p>
<div class="refsect3">
<a name="id-1.1.78.3.10.4"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.11"></a><h3>get-user</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-user self))
</pre></div>
<p>Gets the ‘username’ component of <em class="parameter"><code>uri</code></em>'s userinfo, which may contain
<code class="code">%</code>-encoding, depending on the flags with which <em class="parameter"><code>uri</code></em> was created.
If <em class="parameter"><code>uri</code></em> was not created with <code class="constant">G_URI_FLAGS_HAS_PASSWORD</code> or
<code class="constant">G_URI_FLAGS_HAS_AUTH_PARAMS</code>, this is the same as <code class="function">g_uri_get_userinfo()</code>.</p>
<div class="refsect3">
<a name="id-1.1.78.3.11.4"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.12"></a><h3>get-userinfo</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:get-userinfo self))
</pre></div>
<p>Gets <em class="parameter"><code>uri</code></em>'s userinfo, which may contain <code class="code">%</code>-encoding, depending on
the flags with which <em class="parameter"><code>uri</code></em> was created.</p>
<div class="refsect3">
<a name="id-1.1.78.3.12.4"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.13"></a><h3>parse-relative</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:parse-relative self uri-ref flags))
</pre></div>
<p>Parses <em class="parameter"><code>uri_ref</code></em> according to <em class="parameter"><code>flags</code></em> and, if it is a
[relative URI][relative-absolute-uris], resolves it relative to <em class="parameter"><code>base_uri</code></em>.
If the result is not a valid absolute URI, it will be discarded, and an error
returned.</p>
<div class="refsect3">
<a name="id-1.1.78.3.13.4"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>base_uri</p></td>
<td class="parameter_description">
<p>a base absolute URI</p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>uri_ref</p></td>
<td class="parameter_description">
<p>a string representing a relative or absolute URI</p>
<p>Passed as <code class="code">uri-ref</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags describing how to parse <em class="parameter"><code>uri_ref</code></em></p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.14"></a><h3>to-string</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:to-string self))
</pre></div>
<p>Returns a string representing <em class="parameter"><code>uri</code></em>.
</p>
<p>This is not guaranteed to return a string which is identical to the
string that <em class="parameter"><code>uri</code></em> was parsed from. However, if the source URI was
syntactically correct (according to RFC 3986), and it was parsed
with <code class="constant">G_URI_FLAGS_ENCODED</code>, then <code class="function">g_uri_to_string()</code> is guaranteed to return
a string which is at least semantically equivalent to the source
URI (according to RFC 3986).
</p>
<p>If <em class="parameter"><code>uri</code></em> might contain sensitive details, such as authentication parameters,
or private data in its query string, and the returned string is going to be
logged, then consider using <code class="function">g_uri_to_string_partial()</code> to redact parts.</p>
<div class="refsect3">
<a name="id-1.1.78.3.14.6"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.15"></a><h3>to-string-partial</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:to-string-partial self flags))
</pre></div>
<p>Returns a string representing <em class="parameter"><code>uri</code></em>, subject to the options in
<em class="parameter"><code>flags</code></em>. See <code class="function">g_uri_to_string()</code> and <span class="type">GUriHideFlags</span> for more details.</p>
<div class="refsect3">
<a name="id-1.1.78.3.15.4"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a <span class="type">GUri</span></p>
<p>Passed as <code class="code">self</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags describing what parts of <em class="parameter"><code>uri</code></em> to hide</p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.16"></a><h3>uri:build</h3>
<div class="informalexample"><pre class="programlisting">(define-values
  (%return)
  (uri:build flags scheme userinfo host port path query fragment))
</pre></div>
<p>Creates a new <span class="type">GUri</span> from the given components according to <em class="parameter"><code>flags</code></em>.
</p>
<p>See also <code class="function">g_uri_build_with_user()</code>, which allows specifying the
components of the "userinfo" separately.</p>
<div class="refsect3">
<a name="id-1.1.78.3.16.5"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags describing how to build the <span class="type">GUri</span></p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>scheme</p></td>
<td class="parameter_description">
<p>the URI scheme</p>
<p>Passed as <code class="code">scheme</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>userinfo</p></td>
<td class="parameter_description">
<p>the userinfo component, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">userinfo</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>host</p></td>
<td class="parameter_description">
<p>the host component, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">host</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>port</p></td>
<td class="parameter_description">
<p>the port, or <code class="code">-1</code></p>
<p>Passed as <code class="code">port</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description">
<p>the path component</p>
<p>Passed as <code class="code">path</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>query</p></td>
<td class="parameter_description">
<p>the query component, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">query</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>fragment</p></td>
<td class="parameter_description">
<p>the fragment, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">fragment</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.17"></a><h3>uri:build-with-user</h3>
<div class="informalexample"><pre class="programlisting">(define-values
  (%return)
  (uri:build-with-user
    flags
    scheme
    user
    password
    auth-params
    host
    port
    path
    query
    fragment))
</pre></div>
<p>Creates a new <span class="type">GUri</span> from the given components according to <em class="parameter"><code>flags</code></em>
(<code class="constant">G_URI_FLAGS_HAS_PASSWORD</code> is added unconditionally). The <em class="parameter"><code>flags</code></em> must be
coherent with the passed values, in particular use <code class="code">%</code>-encoded values with
<code class="constant">G_URI_FLAGS_ENCODED</code>.
</p>
<p>In contrast to <code class="function">g_uri_build()</code>, this allows specifying the components
of the ‘userinfo’ field separately. Note that <em class="parameter"><code>user</code></em> must be non-<code class="constant">NULL</code>
if either <em class="parameter"><code>password</code></em> or <em class="parameter"><code>auth_params</code></em> is non-<code class="constant">NULL</code>.</p>
<div class="refsect3">
<a name="id-1.1.78.3.17.5"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags describing how to build the <span class="type">GUri</span></p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>scheme</p></td>
<td class="parameter_description">
<p>the URI scheme</p>
<p>Passed as <code class="code">scheme</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>user</p></td>
<td class="parameter_description">
<p>the user component of the userinfo, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">user</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>password</p></td>
<td class="parameter_description">
<p>the password component of the userinfo, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">password</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>auth_params</p></td>
<td class="parameter_description">
<p>the auth params of the userinfo, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">auth-params</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>host</p></td>
<td class="parameter_description">
<p>the host component, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">host</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>port</p></td>
<td class="parameter_description">
<p>the port, or <code class="code">-1</code></p>
<p>Passed as <code class="code">port</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description">
<p>the path component</p>
<p>Passed as <code class="code">path</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>query</p></td>
<td class="parameter_description">
<p>the query component, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">query</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>fragment</p></td>
<td class="parameter_description">
<p>the fragment, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">fragment</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.18"></a><h3>uri:error-quark</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:error-quark))
</pre></div>
<p>Undocumented</p>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.19"></a><h3>uri:escape-bytes</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:escape-bytes unescaped reserved-chars-allowed))
</pre></div>
<p>Escapes arbitrary data for use in a URI.
</p>
<p>Normally all characters that are not ‘unreserved’ (i.e. ASCII
alphanumerical characters plus dash, dot, underscore and tilde) are
escaped. But if you specify characters in <em class="parameter"><code>reserved_chars_allowed</code></em>
they are not escaped. This is useful for the ‘reserved’ characters
in the URI specification, since those are allowed unescaped in some
portions of a URI.
</p>
<p>Though technically incorrect, this will also allow escaping nul
bytes as <code class="code">%</code><code class="code">00</code>.</p>
<div class="refsect3">
<a name="id-1.1.78.3.19.6"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>unescaped</p></td>
<td class="parameter_description">
<p>the unescaped input data.</p>
<p>Passed as <code class="code">unescaped</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description">
<p>the length of <em class="parameter"><code>unescaped</code></em></p>
<p>Inferred from <code class="code">unescaped</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>reserved_chars_allowed</p></td>
<td class="parameter_description">
<p>a string of reserved
  characters that are allowed to be used, or <code class="constant">NULL</code>.</p>
<p>Passed as <code class="code">reserved-chars-allowed</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.20"></a><h3>uri:escape-string</h3>
<div class="informalexample"><pre class="programlisting">(define-values
  (%return)
  (uri:escape-string unescaped reserved-chars-allowed allow-utf8))
</pre></div>
<p>Escapes a string for use in a URI.
</p>
<p>Normally all characters that are not "unreserved" (i.e. ASCII
alphanumerical characters plus dash, dot, underscore and tilde) are
escaped. But if you specify characters in <em class="parameter"><code>reserved_chars_allowed</code></em>
they are not escaped. This is useful for the "reserved" characters
in the URI specification, since those are allowed unescaped in some
portions of a URI.</p>
<div class="refsect3">
<a name="id-1.1.78.3.20.5"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>unescaped</p></td>
<td class="parameter_description">
<p>the unescaped input string.</p>
<p>Passed as <code class="code">unescaped</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>reserved_chars_allowed</p></td>
<td class="parameter_description">
<p>a string of reserved
  characters that are allowed to be used, or <code class="constant">NULL</code>.</p>
<p>Passed as <code class="code">reserved-chars-allowed</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>allow_utf8</p></td>
<td class="parameter_description">
<p><code class="constant">TRUE</code> if the result can include UTF-8 characters.</p>
<p>Passed as <code class="code">allow-utf8</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.21"></a><h3>uri:is-valid?</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:is-valid? uri-string flags))
</pre></div>
<p>Parses <em class="parameter"><code>uri_string</code></em> according to <em class="parameter"><code>flags</code></em>, to determine whether it is a valid
[absolute URI][relative-absolute-uris], i.e. it does not need to be resolved
relative to another URI using <code class="function">g_uri_parse_relative()</code>.
</p>
<p>If it’s not a valid URI, an error is returned explaining how it’s invalid.
</p>
<p>See <code class="function">g_uri_split()</code>, and the definition of <span class="type">GUriFlags</span>, for more
information on the effect of <em class="parameter"><code>flags</code></em>.</p>
<div class="refsect3">
<a name="id-1.1.78.3.21.6"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>uri_string</p></td>
<td class="parameter_description">
<p>a string containing an absolute URI</p>
<p>Passed as <code class="code">uri-string</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags for parsing <em class="parameter"><code>uri_string</code></em></p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.22"></a><h3>uri:join</h3>
<div class="informalexample"><pre class="programlisting">(define-values
  (%return)
  (uri:join flags scheme userinfo host port path query fragment))
</pre></div>
<p>Joins the given components together according to <em class="parameter"><code>flags</code></em> to create
an absolute URI string. <em class="parameter"><code>path</code></em> may not be <code class="constant">NULL</code> (though it may be the empty
string).
</p>
<p>When <em class="parameter"><code>host</code></em> is present, <em class="parameter"><code>path</code></em> must either be empty or begin with a slash (<code class="code">/</code>)
character. When <em class="parameter"><code>host</code></em> is not present, <em class="parameter"><code>path</code></em> cannot begin with two slash
   characters (<code class="code">//</code>). See
[RFC 3986, section 3](https://tools.ietf.org/html/rfc3986#section-3).
</p>
<p>See also <code class="function">g_uri_join_with_user()</code>, which allows specifying the
components of the ‘userinfo’ separately.
</p>
<p><code class="constant">G_URI_FLAGS_HAS_PASSWORD</code> and <code class="constant">G_URI_FLAGS_HAS_AUTH_PARAMS</code> are ignored if set
in <em class="parameter"><code>flags</code></em>.</p>
<div class="refsect3">
<a name="id-1.1.78.3.22.7"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags describing how to build the URI string</p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>scheme</p></td>
<td class="parameter_description">
<p>the URI scheme, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">scheme</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>userinfo</p></td>
<td class="parameter_description">
<p>the userinfo component, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">userinfo</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>host</p></td>
<td class="parameter_description">
<p>the host component, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">host</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>port</p></td>
<td class="parameter_description">
<p>the port, or <code class="code">-1</code></p>
<p>Passed as <code class="code">port</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description">
<p>the path component</p>
<p>Passed as <code class="code">path</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>query</p></td>
<td class="parameter_description">
<p>the query component, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">query</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>fragment</p></td>
<td class="parameter_description">
<p>the fragment, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">fragment</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.23"></a><h3>uri:join-with-user</h3>
<div class="informalexample"><pre class="programlisting">(define-values
  (%return)
  (uri:join-with-user
    flags
    scheme
    user
    password
    auth-params
    host
    port
    path
    query
    fragment))
</pre></div>
<p>Joins the given components together according to <em class="parameter"><code>flags</code></em> to create
an absolute URI string. <em class="parameter"><code>path</code></em> may not be <code class="constant">NULL</code> (though it may be the empty
string).
</p>
<p>In contrast to <code class="function">g_uri_join()</code>, this allows specifying the components
of the ‘userinfo’ separately. It otherwise behaves the same.
</p>
<p><code class="constant">G_URI_FLAGS_HAS_PASSWORD</code> and <code class="constant">G_URI_FLAGS_HAS_AUTH_PARAMS</code> are ignored if set
in <em class="parameter"><code>flags</code></em>.</p>
<div class="refsect3">
<a name="id-1.1.78.3.23.6"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags describing how to build the URI string</p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>scheme</p></td>
<td class="parameter_description">
<p>the URI scheme, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">scheme</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>user</p></td>
<td class="parameter_description">
<p>the user component of the userinfo, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">user</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>password</p></td>
<td class="parameter_description">
<p>the password component of the userinfo, or
  <code class="constant">NULL</code></p>
<p>Passed as <code class="code">password</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>auth_params</p></td>
<td class="parameter_description">
<p>the auth params of the userinfo, or
  <code class="constant">NULL</code></p>
<p>Passed as <code class="code">auth-params</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>host</p></td>
<td class="parameter_description">
<p>the host component, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">host</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>port</p></td>
<td class="parameter_description">
<p>the port, or <code class="code">-1</code></p>
<p>Passed as <code class="code">port</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description">
<p>the path component</p>
<p>Passed as <code class="code">path</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>query</p></td>
<td class="parameter_description">
<p>the query component, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">query</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>fragment</p></td>
<td class="parameter_description">
<p>the fragment, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">fragment</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.24"></a><h3>uri:list-extract-uris</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:list-extract-uris uri-list))
</pre></div>
<p>Splits an URI list conforming to the text/uri-list
mime type defined in RFC 2483 into individual URIs,
discarding any comments. The URIs are not validated.</p>
<div class="refsect3">
<a name="id-1.1.78.3.24.4"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri_list</p></td>
<td class="parameter_description">
<p>an URI list</p>
<p>Passed as <code class="code">uri-list</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.25"></a><h3>uri:parse</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:parse uri-string flags))
</pre></div>
<p>Parses <em class="parameter"><code>uri_string</code></em> according to <em class="parameter"><code>flags</code></em>. If the result is not a
valid [absolute URI][relative-absolute-uris], it will be discarded, and an
error returned.</p>
<div class="refsect3">
<a name="id-1.1.78.3.25.4"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>uri_string</p></td>
<td class="parameter_description">
<p>a string representing an absolute URI</p>
<p>Passed as <code class="code">uri-string</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags describing how to parse <em class="parameter"><code>uri_string</code></em></p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.26"></a><h3>uri:parse-params</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:parse-params params length separators flags))
</pre></div>
<p>Many URI schemes include one or more attribute/value pairs as part of the URI
value. This method can be used to parse them into a hash table. When an
attribute has multiple occurrences, the last value is the final returned
value. If you need to handle repeated attributes differently, use
<span class="type">GUriParamsIter</span>.
</p>
<p>The <em class="parameter"><code>params</code></em> string is assumed to still be <code class="code">%</code>-encoded, but the returned
values will be fully decoded. (Thus it is possible that the returned values
may contain <code class="code">=</code> or <em class="parameter"><code>separators</code></em>, if the value was encoded in the input.)
Invalid <code class="code">%</code>-encoding is treated as with the <code class="constant">G_URI_FLAGS_PARSE_RELAXED</code>
rules for <code class="function">g_uri_parse()</code>. (However, if <em class="parameter"><code>params</code></em> is the path or query string
from a <span class="type">GUri</span> that was parsed without <code class="constant">G_URI_FLAGS_PARSE_RELAXED</code> and
<code class="constant">G_URI_FLAGS_ENCODED</code>, then you already know that it does not contain any
invalid encoding.)
</p>
<p><code class="constant">G_URI_PARAMS_WWW_FORM</code> is handled as documented for <code class="function">g_uri_params_iter_init()</code>.
</p>
<p>If <code class="constant">G_URI_PARAMS_CASE_INSENSITIVE</code> is passed to <em class="parameter"><code>flags</code></em>, attributes will be
compared case-insensitively, so a params string <code class="code">attr=123&amp;Attr=456</code> will only
return a single attribute–value pair, <code class="code">Attr=456</code>. Case will be preserved in
the returned attributes.
</p>
<p>If <em class="parameter"><code>params</code></em> cannot be parsed (for example, it contains two <em class="parameter"><code>separators</code></em>
characters in a row), then <em class="parameter"><code>error</code></em> is set and <code class="constant">NULL</code> is returned.</p>
<div class="refsect3">
<a name="id-1.1.78.3.26.8"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>params</p></td>
<td class="parameter_description">
<p>a <code class="code">%</code>-encoded string containing <code class="code">attribute=value</code>
  parameters</p>
<p>Passed as <code class="code">params</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description">
<p>the length of <em class="parameter"><code>params</code></em>, or <code class="code">-1</code> if it is nul-terminated</p>
<p>Passed as <code class="code">length</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>separators</p></td>
<td class="parameter_description">
<p>the separator byte character set between parameters. (usually
  <code class="code">&amp;</code>, but sometimes <code class="code">;</code> or both <code class="code">&amp;;</code>). Note that this function works on
  bytes not characters, so it can't be used to delimit UTF-8 strings for
  anything but ASCII characters. You may pass an empty set, in which case
  no splitting will occur.</p>
<p>Passed as <code class="code">separators</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags to modify the way the parameters are handled.</p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.27"></a><h3>uri:parse-scheme</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:parse-scheme uri))
</pre></div>
<p>Gets the scheme portion of a URI string.
[RFC 3986](https://tools.ietf.org/html/rfc3986#section-3) decodes the scheme
as:
</p>
<div class="informalexample"><pre class="programlisting">
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
</pre></div>
<p>Common schemes include <code class="code">file</code>, <code class="code">https</code>, <code class="code">svn+ssh</code>, etc.</p>
<div class="refsect3">
<a name="id-1.1.78.3.27.5"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a valid URI.</p>
<p>Passed as <code class="code">uri</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.28"></a><h3>uri:peek-scheme</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:peek-scheme uri))
</pre></div>
<p>Gets the scheme portion of a URI string.
[RFC 3986](https://tools.ietf.org/html/rfc3986#section-3) decodes the scheme
as:
</p>
<div class="informalexample"><pre class="programlisting">
URI = scheme ":" hier-part [ "?" query ] [ "#" fragment ]
</pre></div>
<p>Common schemes include <code class="code">file</code>, <code class="code">https</code>, <code class="code">svn+ssh</code>, etc.
</p>
<p>Unlike <code class="function">g_uri_parse_scheme()</code>, the returned scheme is normalized to
all-lowercase and does not need to be freed.</p>
<div class="refsect3">
<a name="id-1.1.78.3.28.6"></a><h4>Parameters</h4>
<div class="informaltable"><table><tr>
<td class="parameter_name"><p>uri</p></td>
<td class="parameter_description">
<p>a valid URI.</p>
<p>Passed as <code class="code">uri</code></p>
</td>
</tr></table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.29"></a><h3>uri:resolve-relative</h3>
<div class="informalexample"><pre class="programlisting">(define-values (%return) (uri:resolve-relative base-uri-string uri-ref flags))
</pre></div>
<p>Parses <em class="parameter"><code>uri_ref</code></em> according to <em class="parameter"><code>flags</code></em> and, if it is a
[relative URI][relative-absolute-uris], resolves it relative to
<em class="parameter"><code>base_uri_string</code></em>. If the result is not a valid absolute URI, it will be
discarded, and an error returned.
</p>
<p>(If <em class="parameter"><code>base_uri_string</code></em> is <code class="constant">NULL</code>, this just returns <em class="parameter"><code>uri_ref</code></em>, or
<code class="constant">NULL</code> if <em class="parameter"><code>uri_ref</code></em> is invalid or not absolute.)</p>
<div class="refsect3">
<a name="id-1.1.78.3.29.5"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>base_uri_string</p></td>
<td class="parameter_description">
<p>a string representing a base URI</p>
<p>Passed as <code class="code">base-uri-string</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>uri_ref</p></td>
<td class="parameter_description">
<p>a string representing a relative or absolute URI</p>
<p>Passed as <code class="code">uri-ref</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags describing how to parse <em class="parameter"><code>uri_ref</code></em></p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.30"></a><h3>uri:split</h3>
<div class="informalexample"><pre class="programlisting">(define-values
  (%return scheme userinfo host port path query fragment)
  (uri:split uri-ref flags))
</pre></div>
<p>Parses <em class="parameter"><code>uri_ref</code></em> (which can be an
[absolute or relative URI][relative-absolute-uris]) according to <em class="parameter"><code>flags</code></em>, and
returns the pieces. Any component that doesn't appear in <em class="parameter"><code>uri_ref</code></em> will be
returned as <code class="constant">NULL</code> (but note that all URIs always have a path component,
though it may be the empty string).
</p>
<p>If <em class="parameter"><code>flags</code></em> contains <code class="constant">G_URI_FLAGS_ENCODED</code>, then <code class="code">%</code>-encoded characters in
<em class="parameter"><code>uri_ref</code></em> will remain encoded in the output strings. (If not,
then all such characters will be decoded.) Note that decoding will
only work if the URI components are ASCII or UTF-8, so you will
need to use <code class="constant">G_URI_FLAGS_ENCODED</code> if they are not.
</p>
<p>Note that the <code class="constant">G_URI_FLAGS_HAS_PASSWORD</code> and
<code class="constant">G_URI_FLAGS_HAS_AUTH_PARAMS</code> <em class="parameter"><code>flags</code></em> are ignored by <code class="function">g_uri_split()</code>,
since it always returns only the full userinfo; use
<code class="function">g_uri_split_with_user()</code> if you want it split up.</p>
<div class="refsect3">
<a name="id-1.1.78.3.30.6"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>uri_ref</p></td>
<td class="parameter_description">
<p>a string containing a relative or absolute URI</p>
<p>Passed as <code class="code">uri-ref</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags for parsing <em class="parameter"><code>uri_ref</code></em></p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>scheme</p></td>
<td class="parameter_description">
<p>on return, contains
   the scheme (converted to lowercase), or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">scheme</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>userinfo</p></td>
<td class="parameter_description">
<p>on return, contains
   the userinfo, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">userinfo</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>host</p></td>
<td class="parameter_description">
<p>on return, contains the
   host, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">host</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>port</p></td>
<td class="parameter_description">
<p>on return, contains the
   port, or <code class="code">-1</code></p>
<p>Passed as <code class="code">port</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description">
<p>on return, contains the
   path</p>
<p>Passed as <code class="code">path</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>query</p></td>
<td class="parameter_description">
<p>on return, contains the
   query, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">query</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>fragment</p></td>
<td class="parameter_description">
<p>on return, contains
   the fragment, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">fragment</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.31"></a><h3>uri:split-network</h3>
<div class="informalexample"><pre class="programlisting">(define-values
  (%return scheme host port)
  (uri:split-network uri-string flags))
</pre></div>
<p>Parses <em class="parameter"><code>uri_string</code></em> (which must be an [absolute URI][relative-absolute-uris])
according to <em class="parameter"><code>flags</code></em>, and returns the pieces relevant to connecting to a host.
See the documentation for <code class="function">g_uri_split()</code> for more details; this is
mostly a wrapper around that function with simpler arguments.
However, it will return an error if <em class="parameter"><code>uri_string</code></em> is a relative URI,
or does not contain a hostname component.</p>
<div class="refsect3">
<a name="id-1.1.78.3.31.4"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>uri_string</p></td>
<td class="parameter_description">
<p>a string containing an absolute URI</p>
<p>Passed as <code class="code">uri-string</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags for parsing <em class="parameter"><code>uri_string</code></em></p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>scheme</p></td>
<td class="parameter_description">
<p>on return, contains
   the scheme (converted to lowercase), or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">scheme</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>host</p></td>
<td class="parameter_description">
<p>on return, contains the
   host, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">host</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>port</p></td>
<td class="parameter_description">
<p>on return, contains the
   port, or <code class="code">-1</code></p>
<p>Passed as <code class="code">port</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.32"></a><h3>uri:split-with-user</h3>
<div class="informalexample"><pre class="programlisting">(define-values
  (%return scheme user password auth-params host port path query fragment)
  (uri:split-with-user uri-ref flags))
</pre></div>
<p>Parses <em class="parameter"><code>uri_ref</code></em> (which can be an
[absolute or relative URI][relative-absolute-uris]) according to <em class="parameter"><code>flags</code></em>, and
returns the pieces. Any component that doesn't appear in <em class="parameter"><code>uri_ref</code></em> will be
returned as <code class="constant">NULL</code> (but note that all URIs always have a path component,
though it may be the empty string).
</p>
<p>See <code class="function">g_uri_split()</code>, and the definition of <span class="type">GUriFlags</span>, for more
information on the effect of <em class="parameter"><code>flags</code></em>. Note that <em class="parameter"><code>password</code></em> will only
be parsed out if <em class="parameter"><code>flags</code></em> contains <code class="constant">G_URI_FLAGS_HAS_PASSWORD</code>, and
<em class="parameter"><code>auth_params</code></em> will only be parsed out if <em class="parameter"><code>flags</code></em> contains
<code class="constant">G_URI_FLAGS_HAS_AUTH_PARAMS</code>.</p>
<div class="refsect3">
<a name="id-1.1.78.3.32.5"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>uri_ref</p></td>
<td class="parameter_description">
<p>a string containing a relative or absolute URI</p>
<p>Passed as <code class="code">uri-ref</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description">
<p>flags for parsing <em class="parameter"><code>uri_ref</code></em></p>
<p>Passed as <code class="code">flags</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>scheme</p></td>
<td class="parameter_description">
<p>on return, contains
   the scheme (converted to lowercase), or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">scheme</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>user</p></td>
<td class="parameter_description">
<p>on return, contains
   the user, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">user</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>password</p></td>
<td class="parameter_description">
<p>on return, contains
   the password, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">password</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>auth_params</p></td>
<td class="parameter_description">
<p>on return, contains
   the auth_params, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">auth-params</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>host</p></td>
<td class="parameter_description">
<p>on return, contains the
   host, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">host</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>port</p></td>
<td class="parameter_description">
<p>on return, contains the
   port, or <code class="code">-1</code></p>
<p>Passed as <code class="code">port</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>path</p></td>
<td class="parameter_description">
<p>on return, contains the
   path</p>
<p>Passed as <code class="code">path</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>query</p></td>
<td class="parameter_description">
<p>on return, contains the
   query, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">query</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>fragment</p></td>
<td class="parameter_description">
<p>on return, contains
   the fragment, or <code class="constant">NULL</code></p>
<p>Passed as <code class="code">fragment</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.33"></a><h3>uri:unescape-bytes</h3>
<div class="informalexample"><pre class="programlisting">(define-values
  (%return)
  (uri:unescape-bytes escaped-string length illegal-characters))
</pre></div>
<p>Unescapes a segment of an escaped string as binary data.
</p>
<p>Note that in contrast to <code class="function">g_uri_unescape_string()</code>, this does allow
nul bytes to appear in the output.
</p>
<p>If any of the characters in <em class="parameter"><code>illegal_characters</code></em> appears as an escaped
character in <em class="parameter"><code>escaped_string</code></em>, then that is an error and <code class="constant">NULL</code> will be
returned. This is useful if you want to avoid for instance having a slash
being expanded in an escaped path element, which might confuse pathname
handling.</p>
<div class="refsect3">
<a name="id-1.1.78.3.33.6"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>escaped_string</p></td>
<td class="parameter_description">
<p>A URI-escaped string</p>
<p>Passed as <code class="code">escaped-string</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>length</p></td>
<td class="parameter_description">
<p>the length (in bytes) of <em class="parameter"><code>escaped_string</code></em> to escape, or <code class="code">-1</code> if it
  is nul-terminated.</p>
<p>Passed as <code class="code">length</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>illegal_characters</p></td>
<td class="parameter_description">
<p>a string of illegal characters
  not to be allowed, or <code class="constant">NULL</code>.</p>
<p>Passed as <code class="code">illegal-characters</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.34"></a><h3>uri:unescape-segment</h3>
<div class="informalexample"><pre class="programlisting">(define-values
  (%return)
  (uri:unescape-segment escaped-string escaped-string-end illegal-characters))
</pre></div>
<p>Unescapes a segment of an escaped string.
</p>
<p>If any of the characters in <em class="parameter"><code>illegal_characters</code></em> or the NUL
character appears as an escaped character in <em class="parameter"><code>escaped_string</code></em>, then
that is an error and <code class="constant">NULL</code> will be returned. This is useful if you
want to avoid for instance having a slash being expanded in an
escaped path element, which might confuse pathname handling.
</p>
<p>Note: <code class="code">NUL</code> byte is not accepted in the output, in contrast to
<code class="function">g_uri_unescape_bytes()</code>.</p>
<div class="refsect3">
<a name="id-1.1.78.3.34.6"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>escaped_string</p></td>
<td class="parameter_description">
<p>A string, may be <code class="constant">NULL</code></p>
<p>Passed as <code class="code">escaped-string</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>escaped_string_end</p></td>
<td class="parameter_description">
<p>Pointer to end of <em class="parameter"><code>escaped_string</code></em>,
  may be <code class="constant">NULL</code></p>
<p>Passed as <code class="code">escaped-string-end</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>illegal_characters</p></td>
<td class="parameter_description">
<p>An optional string of illegal
  characters not to be allowed, may be <code class="constant">NULL</code></p>
<p>Passed as <code class="code">illegal-characters</code></p>
</td>
</tr>
</table></div>
</div>
</div>
<div class="refsect2">
<a name="id-1.1.78.3.35"></a><h3>uri:unescape-string</h3>
<div class="informalexample"><pre class="programlisting">(define-values
  (%return)
  (uri:unescape-string escaped-string illegal-characters))
</pre></div>
<p>Unescapes a whole escaped string.
</p>
<p>If any of the characters in <em class="parameter"><code>illegal_characters</code></em> or the NUL
character appears as an escaped character in <em class="parameter"><code>escaped_string</code></em>, then
that is an error and <code class="constant">NULL</code> will be returned. This is useful if you
want to avoid for instance having a slash being expanded in an
escaped path element, which might confuse pathname handling.</p>
<div class="refsect3">
<a name="id-1.1.78.3.35.5"></a><h4>Parameters</h4>
<div class="informaltable"><table>
<tr>
<td class="parameter_name"><p>escaped_string</p></td>
<td class="parameter_description">
<p>an escaped string to be unescaped.</p>
<p>Passed as <code class="code">escaped-string</code></p>
</td>
</tr>
<tr>
<td class="parameter_name"><p>illegal_characters</p></td>
<td class="parameter_description">
<p>a string of illegal characters
  not to be allowed, or <code class="constant">NULL</code>.</p>
<p>Passed as <code class="code">illegal-characters</code></p>
</td>
</tr>
</table></div>
</div>
</div>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.33.1</div>
</body>
</html>
